/* eslint-disable class-methods-use-this */
import {
  post,
  get,
} from '@/lin/plugins/axios'

// 我们通过 class 这样的语法糖使模型这个概念更加具象化，其优点：耦合性低、可维护性。
class Admin {
  async getAdminAll() {
    const res = await get('v1/admin_all')
    return res
  }

  async getAdminList(page, limit, info) {
    const res = await get(`v1/admin?page=${page}&limit=${limit}`, info)
    return res
  }

  async getAdminInfo(id) {
    const res = await get(`v1/admin/${id}`)
    return res
  }

  async createAdmin(info) {
    const res = await post('v1/admin', info)
    return res
  }
}

export default new Admin()
